#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2e5 + 5;

int n, m;
struct Node {
  int val, tag;
  int sz, fa;
  int ch[2];
} tr[N];
#define lc(x) tr[x].ch[0]
#define rc(x) tr[x].ch[1]
int root;
int newnode(int v) {
  static int tot = 0;
  ++tot;
  tr[tot].val = v;
  tr[tot].tag = 0;
  tr[tot].sz = 1;
  tr[tot].fa = tr[tot].ch[0] = tr[tot].ch[1] = 0;
  return tot;
}
void pushup(int x) { tr[x].sz = tr[lc(x)].sz + tr[rc(x)].sz + 1; }
void rotate(int x) {
  int y = tr[x].fa, z = tr[y].fa;
  int k = tr[y].ch[1] == x;
  int k1 = tr[z].ch[1] == y;
  tr[z].ch[k1] = x, tr[x].fa = z;
  tr[y].ch[k] = tr[x].ch[k ^ 1], tr[tr[x].ch[k ^ 1]].fa = y;
  tr[x].ch[k ^ 1] = y, tr[y].fa = x;
  pushup(y), pushup(x);
}
void splay(int x, int k) {
  while (tr[x].fa != k) {
    int y = tr[x].fa, z = tr[y].fa;
    if (z != k) {
      if ((rc(z) == y) ^ (rc(y) == x))
        rotate(x);
      else
        rotate(y);
    }
    rotate(x);
  }
  if (!k) root = x;
}
void insert(int v) {
  int x = root, p = 0;
  while (x) p = x, x = tr[x].ch[tr[x].val < v];
  x = newnode(v);
  tr[p].ch[tr[p].val < v] = x;
  tr[x].fa = p;
  splay(x, 0);
}
void pushdown(int x) {
  if (tr[x].tag) {
    swap(lc(x), rc(x));
    tr[lc(x)].tag ^= 1;
    tr[rc(x)].tag ^= 1;
    tr[x].tag = 0;
  }
}
int get_k(int k) {
  int x = root;
  while (true) {
    pushdown(x);
    if (k <= tr[lc(x)].sz)
      x = lc(x);
    else if (k <= tr[lc(x)].sz + 1)
      break;
    else
      k -= tr[lc(x)].sz + 1, x = rc(x);
  }
  return x;
}
void output(int x) {
  if (!x) return;
  pushdown(x);
  output(lc(x));
  if (tr[x].val >= 1 && tr[x].val <= n) cout << tr[x].val << ' ';
  output(rc(x));
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  insert(0), insert(1e6);
  rep(i, 1, n) insert(i);
  while (m--) {
    int l, r;
    cin >> l >> r;
    if (l > r) swap(l, r);
    r += 2;
    int x = get_k(l), y = get_k(r);
    splay(x, 0), splay(y, x);
    tr[lc(y)].tag ^= 1;
  }
  output(root);
  return 0;
}